﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace ConsoleApp7
{
    public class OrderDetails
    {
        public Goods goods;
        public int price;
        public int num;
        public int ID;
        public OrderDetails(Goods g, int n, int iD)
        {
            goods = g;
            num = n;
            price = goods.price * num;
            ID = iD;
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("购买");
            sb.Append(goods.name);
            sb.Append(num);
            sb.Append("件，");
            sb.Append("花费金额：");
            sb.Append(price);
            return sb.ToString();
        }
        public override bool Equals(object? obj)
        {
            OrderDetails od = obj as OrderDetails;
            return od.ID == ID;
        }
    }
}
